package org.bt.common.convert;

import ma.glasnost.orika.MapperFacade;
import org.bt.common.convertor.Convertor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Bean对象转换处理器
 *
 * @author zwj
 */
@Component
public class BeanConvertor<T, K> implements Convertor<T, K> {

    @Autowired
    private MapperFacade mapperFacade;

    /**
     * 对象转换
     *
     * @param source 转换源对象
     * @param target 转换目标对象
     */
    @Override
    public void convert(T source, K target) {
        mapperFacade.map(source, target);
    }
}
